~ chicken-core (chicken-5) /manual/Module (chicken plist)
Trap1[[tags: manual]]2[[toc:]]34== Module (chicken plist)56As in other Lisp dialects, CHICKEN supports "property lists"7associated with symbols. Properties are accessible via a key that can8be any kind of value but which will be compared using {{eq?}}.910=== get1112<procedure>(get SYMBOL PROPERTY [DEFAULT])</procedure>1314Returns the value stored under the key {{PROPERTY}} in the property15list of {{SYMBOL}}. If no such property is stored, returns16{{DEFAULT}}. The {{DEFAULT}} is optional and defaults to {{#f}}.1718=== put!1920<procedure>(put! SYMBOL PROPERTY VALUE)</procedure>21<procedure>(set! (get SYMBOL PROPERTY) VALUE)</procedure>2223Stores {{VALUE}} under the key {{PROPERTY}} in the property list of24{{SYMBOL}} replacing any previously stored value.2526=== remprop!2728<procedure>(remprop! SYMBOL PROPERTY)</procedure>2930Deletes the first property matching the key {{PROPERTY}} in the31property list of {{SYMBOL}}. Returns {{#t}} when a deletion performed,32and {{#f}} otherwise.3334=== symbol-plist3536<procedure>(symbol-plist SYMBOL)</procedure>37<procedure>(set! (symbol-plist SYMBOL) LST)</procedure>3839Returns the property list of {{SYMBOL}} or sets it. The property list40is a flat list of alternating properties and values.4142This list is not guaranteed to be a fresh copy, so avoid mutating it43directly.4445=== get-properties4647<procedure>(get-properties SYMBOL PROPERTIES)</procedure>4849Searches the property list of {{SYMBOL}} for the first property with a50key in the list {{PROPERTIES}}. Returns 3 values: the matching51property key, value, and the tail of property list after the matching52property. When no match found all values are {{#f}}.5354This tail of the property list is not guaranteed to be a fresh copy,55so avoid mutating it directly.5657{{PROPERTIES}} may also be an atom, in which case it is treated as a58list of one element.5960---61Previous: [[Module (chicken platform)]]6263Next: [[Module (chicken port)]]